home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / libdwarf / pro_section.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-02  |  3.5 KB  |  141 lines

  1. /*
  2.     pro_section.h 
  3.     $Revision: 1.11 $    $Date: 1993/11/15 16:42:48 $    
  4.     $Source: /cmplrs.src/v4.00/libdwarf/RCS/pro_section.h,v $
  5.  
  6.     This struct is used to hold information about all
  7.     debug* sections. On creating a new section, section
  8.     names and indices are added to this struct
  9. */
  10.  
  11. #define     SECTION_NAME_SIZE    20
  12.         /* number of characters in the name of a section */
  13.  
  14. /* defined used to get at the elf section numbers and section name 
  15.    indices in symtab for the dwarf sections */
  16. #define     DEBUG_INFO    0
  17. #define        DEBUG_LINE    1
  18. #define        DEBUG_ABBREV    2
  19. #define        DEBUG_FRAME    3
  20. #define        DEBUG_ARANGES    4
  21. #define        DEBUG_PUBNAMES    5
  22. #define        DEBUG_STR    6
  23. #define        DEBUG_FUNCNAMES 7
  24. #define        DEBUG_TYPENAMES 8
  25. #define        DEBUG_VARNAMES  9
  26. #define        DEBUG_WEAKNAMES 10
  27.  
  28.     /* number of debug_* sections not including the relocations */
  29. #define        NUM_DEBUG_SECTIONS    DEBUG_WEAKNAMES + 1
  30.  
  31. /* struct to hold relocation entries. Its mantained as a linked
  32.    list of relocation structs, and will then be written at as a 
  33.    whole into the relocation section. Whether its 32 bit or
  34.    64 bit will be obtained from Dwarf_Debug pointer.
  35. */
  36.  
  37. typedef struct Dwarf_P_Rel_s     *Dwarf_P_Rel;
  38.  
  39. struct Dwarf_P_Rel_s {
  40.     union {
  41.         Elf32_Rel    *rel32;
  42.     Elf64_Rel    *rel64;
  43.     } dr_relrec;
  44.     Dwarf_P_Rel        dr_next;
  45. };
  46.  
  47. /* macros to access the above structure */
  48. #define dr_rel32(dr_reloc) (dr_reloc->dr_relrec.rel32)
  49. #define dr_rel64(dr_reloc) (dr_reloc->dr_relrec.rel64)
  50.  
  51.  
  52. /*
  53.     struct stores a chunk of data pertaining to a section 
  54. */
  55. struct Dwarf_P_Section_Data_s {
  56.     int             ds_elf_sect_no;    /* elf section number */
  57.     char             *ds_data;    /* data contained in section */
  58.     int                ds_nbytes;    /* bytes of data */
  59.     Dwarf_P_Section_Data    ds_next;
  60. };
  61.  
  62. #define     CHUNK_SIZE         4096
  63.         /* size of chunk of data allocated in one alloc */
  64.  
  65. /*
  66.     chunk alloc routine - 
  67.     if chunk->data is nil, it will alloc CHUNK_SIZE bytes, 
  68.     and return pointer to the beginning. If chunk is not nil, 
  69.     it will see if there's enoungh space for nbytes in current 
  70.     chunk, if not, add new chunk to linked list, and return 
  71.     a char * pointer to it. Return null if unsuccessful.
  72. */
  73. char*
  74.     _dwarf_pro_buffer(Dwarf_P_Debug dbg,int sectno, int nbytes, int new_chunk);
  75.  
  76. #define GET_CHUNK(dbg,sectno,ptr,nbytes,error) \
  77.     { \
  78.         (ptr) = _dwarf_pro_buffer((dbg),(sectno),(nbytes),0); \
  79.         if ((ptr) == NULL) { \
  80.         DWARF_P_DBG_ERROR(dbg,DW_DLE_CHUNK_ALLOC,-1); \
  81.         } \
  82.     }
  83.  
  84. #define GET_NEW_CHUNK(dbg,sectno,ptr,nbytes,error) \
  85.     { \
  86.         (ptr) = _dwarf_pro_buffer((dbg),(sectno),(nbytes),1); \
  87.         if ((ptr) == NULL) { \
  88.         DWARF_P_DBG_ERROR(dbg,DW_DLE_CHUNK_ALLOC,-1); \
  89.         } \
  90.     }
  91.  
  92. /* 
  93.     Get pointer for the nth byte in the section data. Uses the
  94.     linked list, but is transparent to user of function
  95. */
  96. char * _dwarf_pro_nth_byteoff(Dwarf_P_Debug dbg, int byteoff);
  97.  
  98. #define NTH_BYTEOFF(dbg,ptr,n,error) \
  99.     { \
  100.         (ptr) = _dwarf_pro_nth_byteoff((dbg),(n)); \
  101.         if ((ptr) == NULL) { \
  102.         DWARF_P_DBG_ERROR(dbg,DW_DLE_BYTEOFF_ERR,-1); \
  103.         } \
  104.     }
  105.  
  106. int
  107. _dwarf_transform_arange_to_disk (
  108.     Dwarf_P_Debug       dbg,
  109.     Dwarf_Error         *error
  110. );
  111.  
  112. int
  113. _dwarf_transform_pubname_to_disk (
  114.     Dwarf_P_Debug       dbg,
  115.     Dwarf_Error         *error
  116. );
  117.  
  118. int
  119. _dwarf_transform_funcname_to_disk (
  120.     Dwarf_P_Debug    dbg,
  121.     Dwarf_Error        *error
  122. );
  123.  
  124. int
  125. _dwarf_transform_typename_to_disk (
  126.     Dwarf_P_Debug    dbg,
  127.     Dwarf_Error        *error
  128. );
  129.  
  130. int
  131. _dwarf_transform_varname_to_disk (
  132.     Dwarf_P_Debug    dbg,
  133.     Dwarf_Error        *error
  134. );
  135.  
  136. int
  137. _dwarf_transform_weakname_to_disk (
  138.     Dwarf_P_Debug    dbg,
  139.     Dwarf_Error        *error
  140. );
  141.